package com.wuwei.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @description: OrderController <br>
 * @date: 2021/2/19 17:51 <br>
 * @author: wuwei666 <br>
 * @version: 1.0 <br>
 */
@RestController
@Slf4j
public class OrderController {

    @Autowired
    protected RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String prefixUrl;

    @GetMapping("/consumer/nacos/{id}")
    public String order(@PathVariable("id") Integer id){
        return restTemplate.getForObject(prefixUrl + "/payment/nacos/" + id,String.class);
    }
}
